{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "import numpy as np\n",
    "import cv2\n",
    "import pickle\n",
    "import matplotlib.pyplot as plt\n",
    "import random\n",
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn.svm import SVC\n",
    "dir = \"/binaryclassfierTest\"\n",
    "categories = ['apple','banana']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "data = []\n",
    "for category in categories:\n",
    "    path = os.path.join(dir,category)\n",
    "    label = categories.index(category)\n",
    "    \n",
    "    for img in os.listdir(path):\n",
    "        imgpath = os.path.join(path,img)\n",
    "        fruit_img=cv2.imread(imgpath,0)\n",
    "        #cv2.imshow('image',fruit_img)\n",
    "        try:\n",
    "            fruit_img =cv2.resize(fruit_img,(50,50))\n",
    "            image = np.array(fruit_img).flatten()\n",
    "\n",
    "            data.append([image,label])\n",
    "        except Exception as e:\n",
    "            pass\n",
    "        #break\n",
    "    #break\n",
    "#cv2.waitKey(0)\n",
    "#cv2.destroyAllWindows()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "330\n"
     ]
    }
   ],
   "source": [
    "print(len(data))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[array([255, 255, 255, ..., 255, 255, 255], dtype=uint8), 0]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "^C\n",
      "Note: you may need to restart the kernel to use updated packages.\n"
     ]
    }
   ],
   "source": [
    "pip install pickle"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "pick_in = open(\"data1.pickle\",'wb')\n",
    "pickle.dump(data,pick_in)\n",
    "pick_in.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "pick_in = open('data1.pickle','rb')\n",
    "data = pickle.load(pick_in)\n",
    "pick_in.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "random.shuffle(data)\n",
    "features = []\n",
    "labels = []\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [],
   "source": [
    "for feature,label in data:\n",
    "    features.append(feature)\n",
    "    labels.append(label)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [],
   "source": [
    "xtrain,xtest,ytrain,ytest = train_test_split(features,labels,test_size=0.25)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [],
   "source": [
    "model = SVC(C=1,kernel='poly',gamma='auto')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "SVC(C=1, gamma='auto', kernel='poly')"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model.fit(xtrain,ytrain)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [],
   "source": [
    "prediction = model.predict(xtest)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [],
   "source": [
    "accurancy = model.score(xtest,ytest)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "prediction is : banana\n"
     ]
    }
   ],
   "source": [
    "print('prediction is :',categories[prediction[0]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPsAAAD6CAYAAABnLjEDAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAZ9UlEQVR4nO2df5CdZXXHv+feu3d/5PdufrCSQBABBSvoZBCFEQRjU7WS2uqAUGPLTFqnteBoJbSdztixNlNHx7HV6cTKECuVMiNjKOLENBKtSoUEAgYDRiFIZElCfm1+7O97+sdedM95nuR9d/fe3bv3+X5mdu6e5z7P+573vffc9z3nPc95RFVBCGl+CtOtACFkaqCxE5IINHZCEoHGTkgi0NgJSQQaOyGJMCljF5FVIvKMiPxCRNbVSilCSO2RiT5nF5EigJ8DWAlgH4BHAdyoqj873ZiFnUVdvqxlQvubKSjs+RSIkUdQCcY8c6rLyC0vuG0ODob7ucCex4vajo5DS9Ks7H1hCC8fHpHYe6VJbPdyAL9Q1WcBQETuAXA9gNMa+/JlLXhk87JJ7LLxGVFrzEWxN0/HKn3BmGsfX2PkJR8fMXLlOWf9AAa+3G3khy7ZNC49SXNy+e+G35VXmMxt/NkAxm55X7WNENKATMbYY7cKgU8gImtFZLuIbD94aCQyhBAyFUzmNn4fgLH35EsBvOg7qeoGABsAYMWlbU2ViO9v2YHwtt2zevcNQVtl80Ija8dRIxdec24wZl65d9K6kLSYzLfhUQAXiMh5IlIGcAOA+2ujFiGk1kz4yq6qwyLylwA2AygCuFNVn6qZZoSQmjKZ23io6oMAHqyRLoSQOkKnjpBEmNSVPXXyBMB84Gzv3sVBn3N/OWTHzCobuVAK9/Pz755v5I92vDXo8y+v+rGRGbBLG376hCQCjZ2QRKCxE5II9NlrzJGRU0b+4uEVRi4fCE95YcT67KjY3KPC8f5gzLlfeM7I2+RNQZ///ZNHjHxlm91PixSDMaR54ZWdkESgsROSCDR2Qh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hvANwHcpqq9063PmVDVEVW9DKNXzctF5PXTrFIUEXkPgAOqumO6daklU23s+wAsGyMvBfDiFOswXvaLSDcAVF8PTLM+v0FEWjBq6Her6n3V5obV9xVU9SiAbRiNjzSivlcCeK+I7AVwD4BrReTraExdczPVxv4ogAtE5DwRKQO4AcD9U6zDeLkfwJrq/2sw6htPOzK6zMpXAexW1c+PeatR9V0kIvOr/7cDeAeAp9GA+qrqHaq6VFWXY/Q7+j1VvRkNqOu4mIbAx7sA/BzALwH87XQHLZxu3wDQg9H6LPsA3AKgC6OBmj3V187p1rOq61UYdYGeBLCz+veuBtb3DQAer+q7C8DfV9sbUt8xel+D3wboGlrXrD9m0BGSCMygIyQRaOyEJAKNnZBEoLETkgg0dkISgcZOSCLQ2AlJBBo7IYnw/+X8ZvvfiGx6AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "myfruit = xtest[0].reshape(50,50)\n",
    "plt.imshow(myfruit)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [],
   "source": [
    "pick = open('model.sav','wb')\n",
    "pickle.dump(model,pick)\n",
    "pick.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
